using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using Office = Microsoft.Office.Core;
using Outlook = Microsoft.Office.Interop.Outlook;


namespace Wicresoft.SMS.Send
{
    class ContactsGetter
    {
        public static List<ListViewItem> GetContacts()
        {
            Outlook.ContactItem[] items = contacts();
            if (items != null)
            {
                List<ListViewItem> list = new List<ListViewItem>();
                foreach (Outlook.ContactItem item in items)
                {
                    ListViewItem lvi = new ListViewItem();
                    lvi.Text = item.FullName;
                    lvi.SubItems.Add(new ListViewItem.ListViewSubItem(lvi, item.MobileTelephoneNumber));
                    list.Add(lvi);
                }
                return list;
            }
            else
                return null;
        }

        private static GetContactsFromOutlook contacts;

        public static GetContactsFromOutlook Contacts
        {
            get { return ContactsGetter.contacts; }
            set { ContactsGetter.contacts = value; }
        }


    }

    public delegate  Outlook.ContactItem[] GetContactsFromOutlook();

}
